home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / CUTILV1.LZH / LOCATE.C < prev    next >
Text File  |  1984-07-29  |  2KB  |  77 lines

  1. /**************************************************************/
  2. /*                                  */
  3. /*  NAME                              */
  4. /*                                  */
  5. /*     locate - position cursor on screen              */
  6. /*                                  */
  7. /*  SYNOPSIS                              */
  8. /*                                  */
  9. /*     locate(row,col);                      */
  10. /*     short row;        row to place cursor on          */
  11. /*     short col;        column to place cursor on          */
  12. /*                                  */
  13. /*  DESCRIPTION                           */
  14. /*                                  */
  15. /*     This function directly controls the cursor          */
  16. /*     placing it on a specified row and column.  It          */
  17. /*     uses the "csysint" C-to-assembler interface.         */
  18. /*                                  */
  19. /*  RETURNS                              */
  20. /*                                  */
  21. /*     There are no return codes.                  */
  22. /*                                  */
  23. /*  CAUTIONS                              */
  24. /*                                  */
  25. /*     The arguements row and col are limited by the          */
  26. /*     terminal mode (i.e., 24x40, 24x80) and are in          */
  27. /*     the range 1-24 and 1-40 or 1-80 respectively.          */
  28. /*     This routine does not check the arguements.          */
  29. /*                                  */
  30. /**************************************************************/
  31. locate(row,col)
  32. short row,col;
  33. {
  34.      struct regset {
  35.       char al;
  36.       char ah;
  37.       char bl;
  38.       char bh;
  39.       char cl;
  40.       char ch;
  41.       char dl;
  42.       char dh;
  43.      };
  44.      unsigned csysint();
  45.      struct regset sreg;     /* registers passed to csysint */
  46.      struct regset rreg;     /* registers returned from cysint */
  47.      unsigned flags;         /* machine status register */
  48.      int interrupt;         /* type of interrupt requested */
  49.  
  50.      interrupt = 0x10;
  51.      sreg.ah = 0x02;
  52.      sreg.al = 0;
  53.      sreg.bl = 0;
  54.      sreg.bh = 0;
  55.      sreg.cl = 0;
  56.      sreg.ch = 0;
  57.      sreg.dh = row;
  58.      sreg.dl = col;
  59.  
  60.      flags = csysint(interrupt,&sreg,&rreg);
  61. }
  62. /* routine to test the locate command  ---- commented out
  63. main()
  64. {
  65.      short row,col;
  66.  
  67.      cls();             /* clear the screen */
  68.  
  69.      row = 4; col = 20;
  70.      locate(row,col);
  71.      cprintf("Should be row 4, column 20.\n");
  72.  
  73.      locate(15,30);
  74.      cprintf("Should be row 15, columen 30.\n");
  75. }
  76.     --- end of commented code to test the locate command */
  77.